from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer

# 创建聊天机器人实例
Nlp_robot = ChatBot('NLP_robot',
            storage_adapter='chatterbot.storage.SQLStorageAdapter',
            database_uri='sqlite:///database.sqlite3_eng',
            logic_adapters=[
        'chatterbot.logic.MathematicalEvaluation',
        'chatterbot.logic.BestMatch',
        {
            'import_path': 'chatterbot.logic.BestMatch',
            'default_response': '对不起我不能理解你所说的，请给我一点时间学习或者联系。。。',
            'maximum_similarity_threshold': 0.70
        }],
            read_only = True,
                        )


trainer_corpus = ChatterBotCorpusTrainer(Nlp_robot)
trainer_corpus.train('chatterbot.corpus.chinese')